package com.blate.dogxiao.decoration;

import android.content.Context;
import android.graphics.Rect;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.blate.dogxiao.tools.ScreenSizeTools;

/**
 * @author Az
 * on 2020/11/18
 */
public class EquallySpacedDecoration
        extends RecyclerView.ItemDecoration {

    private final int mSpacePx;

    public EquallySpacedDecoration(Context context, float dp) {
        mSpacePx = ScreenSizeTools.dpToPx(context, dp);
    }

    @Override
    public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
        outRect.top = mSpacePx;
        outRect.bottom = mSpacePx;
        outRect.left = mSpacePx;
        outRect.right = mSpacePx;
    }

}
